import request from '@/utils/request'

// 查询组织机构表格树数据
export function getList(query) {
  return request({
    url: '/organization/getList',
    method: 'get',
    params: query
  })
}

// 新增组织机构
export function add(data) {
  return request({
    url: '/organization/add',
    method: 'post',
    data: data
  })
}

// 修改组织机构
export function edit(data) {
  return request({
    url: '/organization/edit',
    method: 'put',
    data: data
  })
}

// 查询组织机构详情
export function getDetail(query) {
  return request({
    url: '/organization/getDetail',
    method: 'get',
    params: query
  })
}
// 删除组织机构详情
export function del(data) {
  return request({
    url: '/organization/del/'+data,
    method: 'delete'
  })
}

// 检测组织机构编码是否唯一
export function checkCodeIsUnique(query) {
  return request({
    url: '/organization/checkCodeIsUnique',
    method: 'get',
    params: query
  })
}

// 检测组织机构编码是否唯一
export function checkNameIsUnique(query) {
  return request({
    url: '/organization/checkNameIsUnique',
    method: 'get',
    params: query
  })
}

// 查询组织机构负责人下拉数据
export function getOrganizationPrincipalPersons(query) {
  return request({
    url: '/organization/getOrganizationPrincipalPersons/'+query,
    method: 'get'
  })
}

// 查询组织机构直属人员
export function getOrganizationDirectEmployees(query) {
  return request({
    url: '/organization/getOrganizationDirectEmployees/'+query,
    method: 'get'
  })
}
// 查询组织机构所有下级机构人员（包括自身）
export function getOrganizationAllChildEmployees(query) {
  return request({
    url: '/organization/getOrganizationAllChildEmployees',
    method: 'get',
    params:query
  })
}
// 查询组织机构全职人员
export function getOrganizationFullJobEmployees(query) {
  return request({
    url: '/organization/getOrganizationFullJobEmployees',
    method: 'get',
    params:query
  })
}
// 查询组织机构兼职人员
export function getOrganizationPartJobEmployees(query) {
  return request({
    url: '/organization/getOrganizationPartJobEmployees',
    method: 'get',
    params:query
  })
}

// 查询组织机构所有下级机构
export function getAllChildOrganization (query) {
  return request({
    url: '/organization/getAllChildOrganization/'+query,
    method: 'get'
  })
}

// 查询组织机构下拉数据
export function getOrganizationsSelectItems () {
  return request({
    url: '/organization/getOrganizationsSelectItems',
    method: 'get'
  })
}
// 查询组织机构下拉数据
export function getOrganizationTypeSelectItems (params) {
  return request({
    url: '/organization/getOrganizationTypeSelectItems',
    method: 'get',
    params: params
  })
}
